package com.cqeec.myblog.service;

import java.util.List;

import com.cqeec.myblog.dao.CategoryDao;
import com.cqeec.myblog.dao.CategoryDaoImpl;
import com.cqeec.myblog.model.Category;

public class CategoryServiceImpl implements CategoryService {
	CategoryDao categoryDao=new CategoryDaoImpl();

	@Override
	public List<Category> getAllCategory() {
		return categoryDao.selectAllCategory();
	}

	@Override
	public void deleteCategoryByCid(String cid) {
        categoryDao.deleteCategoryByCid(cid);		
	}

	@Override
	public void addCategory(String cid, String cname) {
		categoryDao.addCategory(cid,cname);
	}

	@Override
	public boolean findByCname(String cname) {
		Category category=categoryDao.findByCname(cname);
		if(category!=null) {
			return true;
		}
		return false;
	}

}
